<%@ page language="java" contentType="application/ms-word; charset=UTF-8"%>
<%@ page import="com.is.control.*" %>
<%@ page import="com.is.model.*" %>
<%@page import="com.is.util.ParamUtil"%>
<%@page import="java.util.List"%>
<%@page import="com.is.util.DateTime"%>
<%@page import="com.is.util.DesData"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>  
<head>

<style>
	table{border-collapse:collapse;border-spacing:0;border:1px; border-padding:0; width:600px; margin:10px auto;}
	table td{text-align:center; border:1px solid #000; height:26px;}
	caption{font-size:30px;  line-height:44px; font-weight:bold;}
	body{font-size:12px}
</style>
<title>Insert title here</title>
</head>
<body>
<%  
    String fileName = "学生信息WORD文档.doc";  
      //对中文文件名编码  
   //fileName = URLEncoder.encode(fileName, "utf-8");  
    byte[] yte = fileName.getBytes("GB2312");  
            String unicoStr = new String(yte, "ISO-8859-1");
   response.setHeader("Content-disposition", "attachment; filename=" + unicoStr);  
%>  
<% 
	User cu =(User)session.getAttribute("user"); 
	request.setCharacterEncoding("UTF-8");
	String stu = ParamUtil.getString(request,"stu");
	DesData des = new DesData();
	int sid =Integer.parseInt(des.decrypt(stu));
	String stuPart = ParamStuyearControl.getCurrentStudyPart();
	int upStuyear=0;  int downStuyear=0;
	if(stuPart.equals("2")){
		 downStuyear=ParamStuyearControl.getCurrentStuyearId();
		 upStuyear=ParamStuyearControl.getCurrentStuyearId()-1;
	}
	if(stuPart.equals("1")){
	   upStuyear=ParamStuyearControl.getCurrentStuyearId();
	}
	Student s = new Student();
	s = StudentControl.getStudent(sid);
	String defaultPicUrl="../../resources/image/man.GIF";
	String path = "../../User/UserHeadImage/";
	if(sid>0){
%>
<table border='1' class="table">
			<caption>学生信息&nbsp;&nbsp;&nbsp;Information</caption>
			<tbody>
				<tr>
					<td>护照用名<br/>Passport Name</td>
					<td colspan='2'><%=s.getPassportName() %></td>
					<td>中文姓名<br/>Chinese Name</td>
					<td><%=s.getChineseName() %></td>
				</tr>
				<tr>
					<td>国籍</td>
					<td><%=s.getNationality() %></td>
					<td rowspan='2'>性别<br/>Sex</td>
					<td rowspan='2'>
					<%=(s.getSex().equals("1"))?"男":"女" %>
					</td>
					<td colspan='1' rowspan='6'>
						<img id="imgs" src="<%=s.getPicPath() %>" width='150' height='150'/> 
					</td>
				</tr>
				<tr>
					<td>Nationality</td>
					<td><%=s.getNationalityEn() %></td>
				</tr>
				<tr>
					<td>出生日期<br/>Date of Birth</td>
					<td><%=s.getBirthday() %></td>
					<td>班级<br/>Class</td>
					<td>(<%=DateTime.getYear() %>)
					<%
					   List<ParamClass> pcs = ParamClassControl.getParamClassesByGrade(String.valueOf(DateTime.getYear()));
					for(ParamClass pc:pcs){
						%>
			          <%=(pc.getId() == Integer.parseInt(s.getClassId()))?pc.getClassName():"" %>
			
						<%
					}
					%>
					</td>
				</tr>
				<tr>
					<td>护照号码<br/>Passport Number</td>
					<td><%=s.getPassportNumber() %></td>
					<td>CSC 号</td>
					<td><%=s.getCscNumber() %></td>
				</tr>
				<tr>
					<td>经费办法<br/>Type of Scholarship</td>
					<td><%=s.getScholarshipType() %></td>
					<td>类别<br/>Level</td>
					<td><%=s.getLevel() %></td>
				</tr>
				<tr>
					<td>专业院校<br/>University</td>
					<td><%=s.getUniversity() %></td>
					<td>专业<br/>Major</td>
					<td colspan='1'><%=s.getMajor() %></td>
				</tr>
				<tr>
					<td>学习时间<br/>Duration of Study</td>
					<td colspan="4">
						<%=s.getDuration() %>
					</td>
				</tr>
			</tbody>
			</table>
			<%if(stuPart!=null){ %>
			<table>
				<caption>成绩单  Transcript</caption>
				<%
				     if(upStuyear!=0){
				%>
				<tr>
					<td colspan="9">第一学期</td>
				</tr>
				<tr>
					<td rowspan="2" colspan="2">课程名称<br/> Course Type</td>
					<td rowspan="2">总课时<br/> Total Class</td>
					<td rowspan="2">出勤<br/>  Attendance</td>
					<td rowspan="1" colspan="3">成绩<br/>  Score</td>
					<td rowspan="2">总成绩<br/> Total Score</td>
					<td rowspan="2">教师<br/>  Teacher</td>
				</tr>
				<tr>
					<td>平时<br/>Daily</td>
					<td>期中<br/>Midterm</td>
					<td>期末<br/>Final</td>
				</tr>
				<%
				 List<CourseClass> uccs = CourseClassControl.getAllCourseClassIdByClassIdAndStuyear(Integer.parseInt(s.getClassId()),upStuyear);
				for(CourseClass cc:uccs){
					CourseScore cs = CourseScoreControl.getCSByStuIdAndCourseId(cc.getId(),s.getId());
				%>
				<tr>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseName() %></td>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseNameEn() %></td>
					<td><%=cc.getRealTotalClass() %></td>
					<td><%//学生出勤 %></td>
					<%if(cs!=null){%>
					<td><%=cs.getDailyScore() %></td>
					<td><%=cs.getMidtermScore() %></td>
					<td><%=cs.getFinalScore() %></td>
					<td><%=cs.getTotalScore()%></td>
					<%}else{%>
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
				   <%}
				   String tName = UserControl.getUserById(cc.getUid()).getName();
				   %>
					<td><%=(tName==null||tName.equals("null"))?"":tName %></td>
				</tr>
				<%
				}
				}
				if(downStuyear!=0){%>
				<tr>
					<td colspan="9">第二学期</td>
				</tr>
				<tr>
					<td rowspan="2" colspan="2">课程名称<br/> Course Type</td>
					<td rowspan="2">总课时<br/> Total Class</td>
					<td rowspan="2">出勤<br/>  Attendance</td>
					<td rowspan="1" colspan="3">成绩<br/>  Score</td>
					<td rowspan="2">总成绩<br/> Total Score</td>
					<td rowspan="2">教师<br/>  Teacher</td>
				</tr>
				<tr>
					<td>平时<br/>Daily</td>
					<td>期中<br/>Midterm</td>
					<td>期末<br/>Final</td>
				</tr>
				<%
				List<CourseClass> dccs = CourseClassControl.getAllCourseClassIdByClassIdAndStuyear(Integer.parseInt(s.getClassId()),downStuyear);
				for(CourseClass cc:dccs){
					CourseScore cs = CourseScoreControl.getCSByStuIdAndCourseId(cc.getId(),s.getId());
					%>
				<tr>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseName() %></td>
					<td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseNameEn() %></td>
					<td><%=cc.getRealTotalClass() %></td>
					<td><%//学生出勤 %></td>
					<%if(cs!=null){%>
					<td><%=cs.getDailyScore() %></td>
					<td><%=cs.getMidtermScore() %></td>
					<td><%=cs.getFinalScore() %></td>
					<td><%=cs.getTotalScore()%></td>
					<%}else{%>
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
					<td>0.0</td>	
				   <%}
				   String tName = UserControl.getUserById(cc.getUid()).getName();
				   %>
					<td><%=(tName==null||tName.equals("null"))?"":tName %></td>
				</tr>
				<%}
				} %>
			</table>
			<%}%>
			<table>
				<caption>东北师范大学外国留学生预科部学籍表<br/>HSK</caption>
				<tr>
					<td>级别</td>
					<td>Level</td>
					<td>value</td>
				</tr>
				<tr>
					<td>成绩</td>
					<td>Score</td>
					<td>value</td>
				</tr>
			</table>
			<table>
				<caption>学生评定 Evaluation</caption>
				<tr>
					<td width="50%">教师评语</td>
					<td>Teachers’ Comments</td>
				</tr>
				<tr>
					<td height='100' colspan = "2">
						<p></p>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td>班主任（签章）:<br/>Signature</td>
				</tr>
				<tr>
					<td>奖惩记录</td>
					<td>Records of Rewards and Punishments</td>
				</tr>
				<tr>
					<td height='100' colspan = "2">
						<p></p>
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td>办公室负责人（签章）:<br/>Signature</td>
				</tr>
				<tr>
					<td>
						主管（签章）：
					</td>
					<td>
						东北师范大学外国留学生预科部<br/>2012年7月
					</td>
				</tr>
			</table>
			<table>
				<caption>外国留学人员来华签证申请表<br/>Visa Application for Study in China</caption>
				<tr>
					<td ><img height='824' width='590' src="<%=s.getVisaApplicationPath() %>" /></td>
				</tr>
			</table>
			<table>
					<caption>录取通知书<br/>Admission notice</caption>
				<tr>
					<td ><img  height='824' width='590'  src="<%=s.getAdmissionPath() %>"  /></td>
				</tr>
			</table>
			<table>
					<caption>护照<br/>Passport</caption>
				<tr>
					<td><img  height='824' width='590'  src="<%=s.getPassportPath() %>"  /></td>
				</tr>
			</table>
			<table>
					<caption>中华人民共和国签证<br/>Chinese Visa</caption>
				<tr>
					<td><img  height='824' width='590'  src="<%=s.getChineseVisaPath() %>" /></td>
				</tr>
			</table>
			<%}else{
				  out.print("抱歉未能额找到您查找的学生信息");
			} %>
</body>
</html>